import java.util.*;

class Station {
    int distance;
    int price;

    Station(int distance, int price) {
        this.distance = distance;
        this.price = price;
    }
}

public class Main {
    public static String solution(int distance, int n, List<Station> gasStations) {
        PriorityQueue<Station> pq = new PriorityQueue<>((a, b) -> a.price - b.price);
        gasStations.add(new Station(distance, 0));
        Collections.sort(gasStations, (a, b) -> a.distance - b.distance);

        int result = 0, tank = 200, prev = 0;

        for (Station station : gasStations) {
            tank -= station.distance - prev;
            while (!pq.isEmpty() && tank < 0) {
                tank += 200;
                result += pq.poll().price * 200;
            }

            if (tank < 0) return "Impossible";
            pq.offer(station);
            prev = station.distance;
        }

        return Integer.toString(result);
    }

    public static void main(String[] args) {
        List<Station> gasStations = new ArrayList<>();
        gasStations.add(new Station(100, 1));
        gasStations.add(new Station(200, 30));
        gasStations.add(new Station(400, 40));
        gasStations.add(new Station(300, 20));

        System.out.println(solution(500, 4, gasStations));
    }
}